package com.fone.player.sns;

import com.fone.player.sns.bean.SNSUserInfo;


public interface ISNSLoginManager {
	
	public final static int DEFAULT_TYPE = 0;
	public final static int SINA_WEIBO_TYPE = 1;
	public final static int TENCENT_WEIBO_TYPE = 2;
	public final static int TENCENT_QQ_TYPE = 3;
	public final static int TENCENT_WEIXIN_TYPE = 4;

	/**
	 * 通过指定类型 获取对应第三方平台授权
	 * @param type 授权类型
	 * 		ISNSLoginManager.SINA_WEIBO_TYPE
	 * 		ISNSLoginManager.TENCENT_WEIBO_TYPE
	 * 		ISNSLoginManager.TENCENT_QQ_TYPE
	 */
	public void authorizeByType(int type);
	
	/**
	 * 设置授权监听  authorizingStateListener
	 * @param authorizingStateListener
	 */
	public void setAuthiringStateListener(AuthorizingStateListener authorizingStateListener);
	
	/**
	 * 获取已设置的授权监听  AuthorizingStateListener
	 * @return AuthorizingStateListener  未设置 返回null
	 */
	public AuthorizingStateListener getAuthiringStateListener();
	
	/**
	 * 指定类型是否已授权
	 * @param type 授权类型
	 * 		ISNSLoginManager.SINA_WEIBO_TYPE
	 * 		ISNSLoginManager.TENCENT_WEIBO_TYPE
	 * 		ISNSLoginManager.TENCENT_QQ_TYPE
	 */
	public boolean isSNSAuth(int type);
	
	/**
	 * 取消指定类型的授权
	 * @param type 授权类型
	 * 		ISNSLoginManager.SINA_WEIBO_TYPE
	 * 		ISNSLoginManager.TENCENT_WEIBO_TYPE
	 * 		ISNSLoginManager.TENCENT_QQ_TYPE
	 */
	public void CancelAuthSNS(int type);
	
	
	/**
	 * 获取本地已经授权SNSUserInfo
	 * @param type授权类型
	 * 		ISNSLoginManager.SINA_WEIBO_TYPE
	 * 		ISNSLoginManager.TENCENT_WEIBO_TYPE
	 * 		ISNSLoginManager.TENCENT_QQ_TYPE
	 * @return SNSUserInfo
	 */
	public SNSUserInfo getSNSUserInfo(int type);
	/**
	 * 授权监听接口
	 * @author user
	 *
	 */
	public interface AuthorizingStateListener{
		public final static int  AUTHORIZING = 1;
		public final static int  AUTHORIZE_SUCCESS = 2;
		public final static int  AUTHORIZE_CANCEL = 3;
		public final static int  AUTHORIZE_ERROR = 4;
		
		/**
		 * 授权中事件回调
		 * @param action 事件类型
		 * 		AuthorizingStateListener.AUTHORIZING		授权开始时调用
		 * 		AuthorizingStateListener.AUTHORIZE_SUCCESS	授权成功后调用
		 * 		AuthorizingStateListener.AUTHORIZE_CANCEL	授权取消时调用
		 * 		AuthorizingStateListener.AUTHORIZE_ERROR	授权出错时调用
		 * @param info 事件信息
		 */
		public void authrizeAction(int action,String info);
		
		/**
		 * 获取用户信息后的事件回调
		 * @param user 用户信息类
		 */
		public void onUserInfoComplete(SNSUserInfo user);
	}
	
	
}
